﻿package code {
	import flash.display.Loader;
	import flash.display.LoaderInfo;
	import flash.net.*;
	import flash.display.*;
	import flash.events.*;
	public class Card {
		
		// Varibles
		
		private var type:String;		// The card type; Attak, Defence, Item
		private var cardName:String;	// the name of the card
		private var manaCost:int;		// how much the card costs to use
		private var accuracy:Number; 	// percentage of how accurate the move is
		private var image:String;		// image associated with the card
		private var effect:String;		// Effect type
		private var modifier:Number;		// number associated with the effect
		private var description:String;	// Description of the card
		public var cardImage:Bitmap;
		private var myLoader:Loader;
		
		// Properties		
		
		//Type
		public function get Type():String { return type; }
		
		//Card Name
		public function get CardName():String { return cardName; }
		
		//Mana Cost
		public function get ManaCost():int { return manaCost; }
		
		//Accuracy
		public function get Accuracy():Number { return accuracy; }
		
		//Effect
		public function get Effect():String { return effect; }
		
		//Modifier
		public function get Modifier():Number { return modifier; }
		
		//Description
		public function get Description():String { return description; }
		
		//CardImage
		public function get CardImage():Bitmap { return cardImage; }
		
		
		
		
		

		public function Card(typ:String, cardN:String, manaC:int, acc:Number, eff:String, mod:Number, desp:String) {
			// constructor code
			type = typ;
			cardName = cardN;
			manaCost = manaC;
			accuracy = acc;
			effect = eff;
			modifier = mod;
			description = desp;
			
			var fileRequest:URLRequest = new URLRequest("ArtAssets/Card/" + cardN + ".png");
			var fileLoader:Loader = new Loader();
			fileLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, getCard);
			fileLoader.load(fileRequest);
		}
		
		public function getCard(e:Event){
			cardImage = Bitmap(LoaderInfo(e.target).content);
			cardImage.scaleX = 5;
			cardImage.scaleY = 5;
		}
		
		public function getSmallCard():Bitmap{
			var tempCard:Bitmap = new Bitmap();
			
			tempCard = cardImage;
			
			tempCard.scaleX = 1;
			tempCard.scaleY = 1;
			
			return tempCard;
		}

	}
	
}
